from account.account_service import AccountService
from typing import Dict


class AccountManager:
    def __init__(self) -> None:
        self.__service_dict: Dict[int, AccountService] = {}

    def add_service(self, platform_id: int, service: AccountService):
        self.__service_dict[platform_id] = service
        
    def all_service(self):
        return self.__service_dict.values()

    def take_account(self, platform_id: int):
        if platform_id in self.__service_dict:
            return self.__service_dict[platform_id].take()

    def invalid_account(self, platform_id: int, account) -> bool:
        if platform_id in self.__service_dict:
            return self.__service_dict[platform_id].invalid(account)

    def account_count(self, platform_id: int):
        if platform_id in self.__service_dict:
            return self.__service_dict[platform_id].count()

    def active_service(self, platform_id: int):
        if platform_id in self.__service_dict:
            self.__service_dict[platform_id].active()
